package com.coincalf.exchange.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 * 用户财产记录
 * </p>
 *
 * @author qiang
 * @since 2018-05-12
 */
@Data
@Accessors(chain = true)
public class Account extends Model<Account> {

    private static final long serialVersionUID = 1L;

    /**
     * 自增id
     */
    @TableId(value = "id", type = IdType.ID_WORKER)
    private Long id;

    /**
     * 用户id
     */
    @TableField("user_id")
    private Long userId;

    /**
     * 币种id
     */
    @TableField("coin_id")
    private Long coinId;

    /**
     * 账号状态：1，正常；2，冻结；
     */
    private Integer status;

    /**
     * 币种可用金额
     */
    @TableField("balance_amount")
    private BigDecimal balanceAmount;

    /**
     * 币种冻结金额
     */
    @TableField("freeze_amount")
    private BigDecimal freezeAmount;

    /**
     * 累计充值金额
     */
    @TableField("recharge_amount")
    private BigDecimal rechargeAmount;

    /**
     * 累计提现金额
     */
    @TableField("withdrawals_amount")
    private BigDecimal withdrawalsAmount;

    /**
     * 净值
     */
    @TableField("net_value")
    private BigDecimal netValue;

    /**
     * 占用保证金
     */
    @TableField("lock_margin")
    private BigDecimal lockMargin;

    /**
     * 持仓盈亏/浮动盈亏
     */
    @TableField("float_profit")
    private BigDecimal floatProfit;

    /**
     * 总盈亏
     */
    @TableField("total_profit")
    private BigDecimal totalProfit;

    /**
     * 充值地址
     */
    @TableField("rec_addr")
    private String recAddr;

    /**
     * 版本号
     */
    private Long version;

    /**
     * 更新时间
     */
    @TableField("last_update_time")
    private Date lastUpdateTime;

    /**
     * 创建时间
     */
    private Date created;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
